home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 6
/
CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso
/
cucd
/
readers
/
utils
/
gui4cli
/
g4c
/
gm
/
colourcode.gc
next >
Wrap
Text File
|
1996-10-28
|
3KB
|
152 lines
G4C
; Author: Graham Maddox
; Date: 1 Oct 1996
; GUI: Finds resistor values. For electronics hobbyists.
WinBig -1 -1 290 124 "ColourCode"
WinSmall 200 0 240 -1
WinType 11110001
WinOut NIL:
xOnLoad
Gosub colourcode.gc initvar
GuiOpen colourcode.gc
xOnClose
GuiQuit colourcode.gc
BOX 0 0 0 0 OUT ICONDROP
BOX 15 6 260 76 OUT BUTTON
xCycler 140 12 90 13 "First Band" cc_first
GadID 2
GadTitle ABOVE
CSTR "Black" "0"
CSTR "Brown" "1"
CSTR "Red" "2"
CSTR "Orange" "3"
CSTR "Yellow" "4"
CSTR "Green" "5"
CSTR "Blue" "6"
CSTR "Purple" "7"
CSTR "Grey" "8"
CSTR "White" "9"
xCycler 140 29 90 13 "Second Band" cc_sec
GadID 3
GadTitle ABOVE
CSTR "Black" "0"
CSTR "Brown" "1"
CSTR "Red" "2"
CSTR "Orange" "3"
CSTR "Yellow" "4"
CSTR "Green" "5"
CSTR "Blue" "6"
CSTR "Purple" "7"
CSTR "Grey" "8"
CSTR "White" "9"
xCycler 140 46 90 13 "Multiplier" cc_mult
GadID 4
GadTitle ABOVE
CSTR "Black" "black"
CSTR "Brown" "brown"
CSTR "Red" "red"
CSTR "Orange" "orange"
CSTR "Yellow" "yellow"
CSTR "Green" "green"
CSTR "Blue" "blue"
CSTR "Gold" "gold"
xCycler 140 63 90 13 "Tolerance" cc_tol
GadID 5
GadTitle ABOVE
CSTR "Brown" "±1%"
CSTR "Red" "±2%"
CSTR "Gold" "±5%"
CSTR "Silver" "±10%"
CSTR "None" "±20%"
Text 20 88 250 13 "" 70 BOX
GadID 1
xButton 20 105 90 12 "Calculate"
Gosub colourcode.gc calc
xButton 210 105 60 12 "Quit"
GuiQuit colourcode.gc
xRoutine initvar
Setvar cc_first "1"
Setvar cc_sec "0"
Setvar cc_mult "brown"
Setvar cc_tol "±5%"
Update colourcode.gc 2 1
Update colourcode.gc 3 0
Update colourcode.gc 4 0
Update colourcode.gc 5 2
Return
xRoutine calc
Setvar cc_res ""
DoCase $cc_mult
Case = "black"
Appvar cc_res '$cc_first'
Appvar cc_res '$cc_sec'
Appvar cc_res "R"
BREAK
Case = "brown"
Appvar cc_res '$cc_first'
Appvar cc_res '$cc_sec'
Appvar cc_res "0R"
BREAK
Case = "red"
Appvar cc_res '$cc_first'
Appvar cc_res "K"
Appvar cc_res '$cc_sec'
BREAK
Case = "orange"
Appvar cc_res '$cc_first'
Appvar cc_res '$cc_sec'
Appvar cc_res "K"
BREAK
Case = "yellow"
Appvar cc_res '$cc_first'
Appvar cc_res '$cc_sec'
Appvar cc_res "0K"
BREAK
Case = "green"
Appvar cc_res '$cc_first'
Appvar cc_res "M"
Appvar cc_res '$cc_sec'
BREAK
Case = "blue"
Appvar cc_res '$cc_first'
Appvar cc_res '$cc_sec'
Appvar cc_res "M"
BREAK
Case = "gold"
Appvar cc_res "$cc_first"
Appvar cc_res "R"
Appvar cc_res '$cc_sec'
BREAK
EndCase
Update colourcode.gc 1 "Resistor Value: $cc_res @ $cc_tol"
Return